<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>FormulaEvaluator (POI API Documentation)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="FormulaEvaluator (POI API Documentation)";
    }
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!--   -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/FormulaEvaluator.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/poi/ss/usermodel/FormulaError.html" title="enum in org.apache.poi.ss.usermodel"><span class="strong">PREV CLASS</span></a></li>
<li><a href="../../../../../org/apache/poi/ss/usermodel/FractionFormat.html" title="class in org.apache.poi.ss.usermodel"><span class="strong">NEXT CLASS</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/poi/ss/usermodel/FormulaEvaluator.html" target="_top">FRAMES</a></li>
<li><a href="FormulaEvaluator.html" target="_top">NO FRAMES</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>SUMMARY:&nbsp;</li>
<li>NESTED&nbsp;|&nbsp;</li>
<li>FIELD&nbsp;|&nbsp;</li>
<li>CONSTR&nbsp;|&nbsp;</li>
<li><a href="#method_summary">METHOD</a></li>
</ul>
<ul class="subNavList">
<li>DETAIL:&nbsp;</li>
<li>FIELD&nbsp;|&nbsp;</li>
<li>CONSTR&nbsp;|&nbsp;</li>
<li><a href="#method_detail">METHOD</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<p class="subTitle">org.apache.poi.ss.usermodel</p>
<h2 title="Interface FormulaEvaluator" class="title">Interface FormulaEvaluator</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../../../../org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.html" title="class in org.apache.poi.hssf.usermodel">HSSFFormulaEvaluator</a>, <a href="../../../../../org/apache/poi/xssf/usermodel/XSSFFormulaEvaluator.html" title="class in org.apache.poi.xssf.usermodel">XSSFFormulaEvaluator</a></dd>
</dl>
<hr>
<br>
<pre>public interface <strong>FormulaEvaluator</strong></pre>
<div class="block">Evaluates formula cells.<p/>
 
 For performance reasons, this class keeps a cache of all previously calculated intermediate
 cell values.  Be sure to call <a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#clearAllCachedResultValues()"><code>clearAllCachedResultValues()</code></a> if any workbook cells are changed between
 calls to evaluate~ methods on this class.</div>
<dl><dt><span class="strong">Author:</span></dt>
  <dd>Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;, Josh Micich</dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!--   -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#clearAllCachedResultValues()">clearAllCachedResultValues</a></strong>()</code>
<div class="block">Should be called whenever there are changes to input cells in the evaluated workbook.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../org/apache/poi/ss/usermodel/CellValue.html" title="class in org.apache.poi.ss.usermodel">CellValue</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#evaluate(org.apache.poi.ss.usermodel.Cell)">evaluate</a></strong>(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a>&nbsp;cell)</code>
<div class="block">If cell contains a formula, the formula is evaluated and returned,
 else the CellValue simply copies the appropriate cell value from
 the cell and also its cell type.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#evaluateAll()">evaluateAll</a></strong>()</code>
<div class="block">Loops over all cells in all sheets of the associated workbook.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#evaluateFormulaCell(org.apache.poi.ss.usermodel.Cell)">evaluateFormulaCell</a></strong>(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a>&nbsp;cell)</code>
<div class="block">If cell contains formula, it evaluates the formula,
  and saves the result of the formula.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#evaluateInCell(org.apache.poi.ss.usermodel.Cell)">evaluateInCell</a></strong>(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a>&nbsp;cell)</code>
<div class="block">If cell contains formula, it evaluates the formula, and
  puts the formula result back into the cell, in place
  of the old formula.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#notifyDeleteCell(org.apache.poi.ss.usermodel.Cell)">notifyDeleteCell</a></strong>(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a>&nbsp;cell)</code>
<div class="block">Should be called to tell the cell value cache that the specified cell has just become a
 formula cell, or the formula text has changed</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#notifySetFormula(org.apache.poi.ss.usermodel.Cell)">notifySetFormula</a></strong>(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a>&nbsp;cell)</code>
<div class="block">Should be called to tell the cell value cache that the specified (value or formula) cell 
 has changed.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#notifyUpdateCell(org.apache.poi.ss.usermodel.Cell)">notifyUpdateCell</a></strong>(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a>&nbsp;cell)</code>
<div class="block">Should be called to tell the cell value cache that the specified (value or formula) cell
 has changed.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#setDebugEvaluationOutputForNextEval(boolean)">setDebugEvaluationOutputForNextEval</a></strong>(boolean&nbsp;value)</code>
<div class="block">Perform detailed output of formula evaluation for next evaluation only?
 Is for developer use only (also developers using POI for their XLS files).</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#setIgnoreMissingWorkbooks(boolean)">setIgnoreMissingWorkbooks</a></strong>(boolean&nbsp;ignore)</code>
<div class="block">Whether to ignore missing references to external workbooks and
 use cached formula results in the main workbook instead.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#setupReferencedWorkbooks(java.util.Map)">setupReferencedWorkbooks</a></strong>(java.util.Map&lt;java.lang.String,<a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html" title="interface in org.apache.poi.ss.usermodel">FormulaEvaluator</a>&gt;&nbsp;workbooks)</code>
<div class="block">Sets up the Formula Evaluator to be able to reference and resolve
  links to other workbooks, eg [Test.xls]Sheet1!A1.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!--   -->
</a>
<h3>Method Detail</h3>
<a name="clearAllCachedResultValues()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>clearAllCachedResultValues</h4>
<pre>void&nbsp;clearAllCachedResultValues()</pre>
<div class="block">Should be called whenever there are changes to input cells in the evaluated workbook.
 Failure to call this method after changing cell values will cause incorrect behaviour
 of the evaluate~ methods of this class</div>
</li>
</ul>
<a name="notifySetFormula(org.apache.poi.ss.usermodel.Cell)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>notifySetFormula</h4>
<pre>void&nbsp;notifySetFormula(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a>&nbsp;cell)</pre>
<div class="block">Should be called to tell the cell value cache that the specified (value or formula) cell 
 has changed.
 Failure to call this method after changing cell values will cause incorrect behaviour
 of the evaluate~ methods of this class</div>
</li>
</ul>
<a name="notifyDeleteCell(org.apache.poi.ss.usermodel.Cell)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>notifyDeleteCell</h4>
<pre>void&nbsp;notifyDeleteCell(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a>&nbsp;cell)</pre>
<div class="block">Should be called to tell the cell value cache that the specified cell has just become a
 formula cell, or the formula text has changed</div>
</li>
</ul>
<a name="notifyUpdateCell(org.apache.poi.ss.usermodel.Cell)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>notifyUpdateCell</h4>
<pre>void&nbsp;notifyUpdateCell(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a>&nbsp;cell)</pre>
<div class="block">Should be called to tell the cell value cache that the specified (value or formula) cell
 has changed.
 Failure to call this method after changing cell values will cause incorrect behaviour
 of the evaluate~ methods of this class</div>
</li>
</ul>
<a name="evaluateAll()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>evaluateAll</h4>
<pre>void&nbsp;evaluateAll()</pre>
<div class="block">Loops over all cells in all sheets of the associated workbook.
 For cells that contain formulas, their formulas are evaluated, 
  and the results are saved. These cells remain as formula cells.
 For cells that do not contain formulas, no changes are made.
 This is a helpful wrapper around looping over all cells, and 
  calling evaluateFormulaCell on each one.</div>
</li>
</ul>
<a name="evaluate(org.apache.poi.ss.usermodel.Cell)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>evaluate</h4>
<pre><a href="../../../../../org/apache/poi/ss/usermodel/CellValue.html" title="class in org.apache.poi.ss.usermodel">CellValue</a>&nbsp;evaluate(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a>&nbsp;cell)</pre>
<div class="block">If cell contains a formula, the formula is evaluated and returned,
 else the CellValue simply copies the appropriate cell value from
 the cell and also its cell type. This method should be preferred over
 evaluateInCell() when the call should not modify the contents of the
 original cell.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>cell</code> - </dd></dl>
</li>
</ul>
<a name="evaluateFormulaCell(org.apache.poi.ss.usermodel.Cell)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>evaluateFormulaCell</h4>
<pre>int&nbsp;evaluateFormulaCell(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a>&nbsp;cell)</pre>
<div class="block">If cell contains formula, it evaluates the formula,
  and saves the result of the formula. The cell
  remains as a formula cell.
 Else if cell does not contain formula, this method leaves
  the cell unchanged.
 Note that the type of the formula result is returned,
  so you know what kind of value is also stored with
  the formula.
 <pre>
 int evaluatedCellType = evaluator.evaluateFormulaCell(cell);
 </pre>
 Be aware that your cell will hold both the formula,
  and the result. If you want the cell replaced with
  the result of the formula, use <a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#evaluateInCell(org.apache.poi.ss.usermodel.Cell)"><code>evaluateInCell(Cell)</code></a></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>cell</code> - The cell to evaluate</dd>
<dt><span class="strong">Returns:</span></dt><dd>The type of the formula result, i.e. -1 if the cell is not a formula, 
      or one of Cell.CELL_TYPE_NUMERIC, Cell.CELL_TYPE_STRING, Cell.CELL_TYPE_BOOLEAN, Cell.CELL_TYPE_ERROR
      Note: the cell's type remains as Cell.CELL_TYPE_FORMULA however.</dd></dl>
</li>
</ul>
<a name="evaluateInCell(org.apache.poi.ss.usermodel.Cell)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>evaluateInCell</h4>
<pre><a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a>&nbsp;evaluateInCell(<a href="../../../../../org/apache/poi/ss/usermodel/Cell.html" title="interface in org.apache.poi.ss.usermodel">Cell</a>&nbsp;cell)</pre>
<div class="block">If cell contains formula, it evaluates the formula, and
  puts the formula result back into the cell, in place
  of the old formula.
 Else if cell does not contain formula, this method leaves
  the cell unchanged.
 Note that the same instance of Cell is returned to
 allow chained calls like:
 <pre>
 int evaluatedCellType = evaluator.evaluateInCell(cell).getCellType();
 </pre>
 Be aware that your cell value will be changed to hold the
  result of the formula. If you simply want the formula
  value computed for you, use <a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html#evaluateFormulaCell(org.apache.poi.ss.usermodel.Cell)"><code>evaluateFormulaCell(Cell)</code></a></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>cell</code> - </dd></dl>
</li>
</ul>
<a name="setupReferencedWorkbooks(java.util.Map)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setupReferencedWorkbooks</h4>
<pre>void&nbsp;setupReferencedWorkbooks(java.util.Map&lt;java.lang.String,<a href="../../../../../org/apache/poi/ss/usermodel/FormulaEvaluator.html" title="interface in org.apache.poi.ss.usermodel">FormulaEvaluator</a>&gt;&nbsp;workbooks)</pre>
<div class="block">Sets up the Formula Evaluator to be able to reference and resolve
  links to other workbooks, eg [Test.xls]Sheet1!A1.
 <p>For a workbook referenced as [Test.xls]Sheet1!A1, you should
  supply a map containing the key Test.xls (no square brackets),
  and an open FormulaEvaluator onto that Workbook.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>workbooks</code> - Map of workbook names (no square brackets) to an evaluator on that workbook</dd></dl>
</li>
</ul>
<a name="setIgnoreMissingWorkbooks(boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setIgnoreMissingWorkbooks</h4>
<pre>void&nbsp;setIgnoreMissingWorkbooks(boolean&nbsp;ignore)</pre>
<div class="block">Whether to ignore missing references to external workbooks and
 use cached formula results in the main workbook instead.
 <p>
 In some cases external workbooks referenced by formulas in the main workbook are not available.
 With this method you can control how POI handles such missing references:
 <ul>
     <li>by default ignoreMissingWorkbooks=false and POI throws 
     <a href="../../../../../org/apache/poi/ss/formula/CollaboratingWorkbooksEnvironment.WorkbookNotFoundException.html" title="class in org.apache.poi.ss.formula"><code>CollaboratingWorkbooksEnvironment.WorkbookNotFoundException</code></a>
     if an external reference cannot be resolved</li>
     <li>if ignoreMissingWorkbooks=true then POI uses cached formula result
     that already exists in the main workbook</li>
 </ul></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>ignore</code> - whether to ignore missing references to external workbooks</dd></dl>
</li>
</ul>
<a name="setDebugEvaluationOutputForNextEval(boolean)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>setDebugEvaluationOutputForNextEval</h4>
<pre>void&nbsp;setDebugEvaluationOutputForNextEval(boolean&nbsp;value)</pre>
<div class="block">Perform detailed output of formula evaluation for next evaluation only?
 Is for developer use only (also developers using POI for their XLS files).
 Log-Level WARN is for basic info, INFO for detailed information. These quite
 high levels are used because you have to explicitly enable this specific logging.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>value</code> - whether to perform detailed output</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!--   -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/FormulaEvaluator.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/poi/ss/usermodel/FormulaError.html" title="enum in org.apache.poi.ss.usermodel"><span class="strong">PREV CLASS</span></a></li>
<li><a href="../../../../../org/apache/poi/ss/usermodel/FractionFormat.html" title="class in org.apache.poi.ss.usermodel"><span class="strong">NEXT CLASS</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/poi/ss/usermodel/FormulaEvaluator.html" target="_top">FRAMES</a></li>
<li><a href="FormulaEvaluator.html" target="_top">NO FRAMES</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>SUMMARY:&nbsp;</li>
<li>NESTED&nbsp;|&nbsp;</li>
<li>FIELD&nbsp;|&nbsp;</li>
<li>CONSTR&nbsp;|&nbsp;</li>
<li><a href="#method_summary">METHOD</a></li>
</ul>
<ul class="subNavList">
<li>DETAIL:&nbsp;</li>
<li>FIELD&nbsp;|&nbsp;</li>
<li>CONSTR&nbsp;|&nbsp;</li>
<li><a href="#method_detail">METHOD</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>
                <i>Copyright 2014 The Apache Software Foundation or
        its licensors, as applicable.</i>
            </small></p>
</body>
</html>
